package org.accp.task.service.impl;


import entity.task_info;

import org.accp.task.dto.PageBean;
import org.accp.task.dto.TaskDto;
import org.accp.task.mapper.taskInfoMapper;
import org.accp.task.service.taskInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class taskInfoServiceImpl implements taskInfoService {
    @Resource
    private taskInfoMapper taskInfoMapper;


    @Override
    public PageBean alltaskInfo(TaskDto d) {
        if(d.getPageIndex()==null) d.setPageIndex(1);
        if(d.getPageEnd()==null) d.setPageEnd(5);
        int count=this.taskInfoMapper.count(d);
        PageBean p=new PageBean(d.getPageIndex(),d.getPageEnd(),count);
        d.setPageIndex(p.getStartIndex());
        d.setPageEnd(p.getEndIndex());
        p.setData(this.taskInfoMapper.alltaskInfo(d));
        return p;
    }

    @Override
    public Integer count(TaskDto d) {
        return this.taskInfoMapper.count(d);
    }

    @Override
    public void Tastinsert(task_info t) {
        this.taskInfoMapper.Tastinsert(t);
    }

    @Override
    public void UpTask(task_info t) {
        this.taskInfoMapper.UpTask(t);
    }
}
